
var initCmsNodeInfoBean;
var getCmsNodeInfoBeanFromOpenPage = function(){
	var cmsnodeinfoBean = {};
	cmsnodeinfoBean.id = jQuery('#idEditor').val();
	if(!cmsnodeinfoBean.id){
		cmsnodeinfoBean.id = null;
	}
	cmsnodeinfoBean.name = jQuery('#nameEditor').val();
	
	if(!cmsnodeinfoBean.name){
		$.ligerDialog.error("请输入名称!");
		return null;
	}	cmsnodeinfoBean.type = jQuery('#typeEditor').val();
	
	if(!cmsnodeinfoBean.type){
		$.ligerDialog.error("请输入类型!");
		return null;
	}	cmsnodeinfoBean.pid = jQuery('#pidEditor').val();
	
	if(!cmsnodeinfoBean.pid){
		$.ligerDialog.error("请输入父节点!");
		return null;
	}	cmsnodeinfoBean.sid = jQuery('#sidEditor').val();
	
	if(!cmsnodeinfoBean.sid){
		$.ligerDialog.error("请输入位置!");
		return null;
	}	cmsnodeinfoBean.valid = jQuery('#validEditor').val();
	
	if(!cmsnodeinfoBean.valid){
		$.ligerDialog.error("请输入有效性!");
		return null;
	}	
	return cmsnodeinfoBean;
};

var initCmsNodeInfoPage = function(){
	jQuery('#ligerType').ligerComboBox({
		data:cmsNodeTypeRenderData,
		valueField:'value',
		textField:'text',
		valueFieldID:'typeEditor'
	});
	jQuery('#ligerValid').ligerComboBox({
		data:validRenderData,
		valueField:'value',
		textField:'text',
		valueFieldID:'validEditor'
	});
};

var bindCmsNodeInfoUpdateButtom = function(){
	jQuery('#updateEdit').unbind('click').click(function(){
		var cmsnodeinfoBean = getCmsNodeInfoBeanFromOpenPage();
		if(null != cmsnodeinfoBean){
			doSaveCmsNodeInfos([cmsnodeinfoBean]);
		}
	});
};
var bindCmsNodeInfoResetButtom = function(){
	jQuery('#resetEdit').unbind('click').click(function(){
		if(!initCmsNodeInfoBean){
			jQuery("#nameEditor").val('');
			jQuery("#typeEditor").val('');
			jQuery("#pidEditor").val('');
			jQuery("#sidEditor").val('');
			jQuery("#validEditor").val('');
		}else{
			if(!initCmsNodeInfoBean.name){
				jQuery("#nameEditor").val('');
			}else{
				jQuery("#nameEditor").val(initCmsNodeInfoBean.name);
			}
			if(!initCmsNodeInfoBean.type){
				jQuery("#typeEditor").val('');
			}else{
				jQuery("#typeEditor").val(initCmsNodeInfoBean.type);
			}
			if(!initCmsNodeInfoBean.pid){
				jQuery("#pidEditor").val('');
			}else{
				jQuery("#pidEditor").val(initCmsNodeInfoBean.pid);
			}
			if(!initCmsNodeInfoBean.sid){
				jQuery("#sidEditor").val('');
			}else{
				jQuery("#sidEditor").val(initCmsNodeInfoBean.sid);
			}
			if(!initCmsNodeInfoBean.valid){
				jQuery("#validEditor").val('');
			}else{
				jQuery("#validEditor").val(initCmsNodeInfoBean.valid);
			}
		}
	});
};



jQuery(function(){
	initCmsNodeInfoPage();
	bindCmsNodeInfoUpdateButtom();
	bindCmsNodeInfoResetButtom();
});